clear all
disp('MC price')
tic
Npath=10000;

randseed =randn(5000,Npath);
sampleou=oupath(randseed,1,1,1,1);
randseed =randn(5000,Npath); % because of uncorrelated
sampleX =mcprice(sampleou,randseed);
tmp =sum(abs(sampleX),2)/Npath;
mtclprice=tmp(1:100:5001);


% tic
% intsigmasq=zeros(51,1);
% for pn=1:Npath
%     samplepath=getapath(5001,'ou');
%     sigmasq=samplepath.^2; 
%     for jj=1:51
%         intsigmasq(jj)=intsigmasq(jj)+midptrule(sigmasq(1:(jj-1)*100+1),1/10000);
%     end
% end
% mcpart=zeros(51,1);
% for pn=1:Npath
%     samplepath=getapath(5001,'sigmadW');
%     sigmadW=abs(samplepath); 
%     for jj=1:51
%         mcpart(jj)=mcpart(jj)+sigmadW((jj-1)*100+1);
%     end
% end
% mcpart=mcpart/Npath;
% 
% intsigmasq=intsigmasq/Npath;
toc

time=(0:50)/100;
plot(time, mtclprice,'r')